<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>	
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link href="<%=basePath %>themes/css/login.css" rel="stylesheet" type="text/css" />
<title>客户信息管理系统</title>
<script type="text/javascript">
<!--

//-->
// 是否预约select的change事件：是-显现预约信息层；否-不显现，并清空内容
function displayData(){

	var flag = $("#schema option:selected").val();
	if(flag == '10'){
		document.getElementById('operationDiv').style.display='block';
		document.getElementById('medicineDiv').style.display='none';
	}else if(flag == '50'){
		document.getElementById('medicineDiv').style.display='block'; 
		document.getElementById('operationDiv').style.display='none';
	}
	
}

function findObj(theObj, theDoc){ 
	var p, i, foundObj; 
	if(!theDoc) theDoc = document; 
	if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {    
		theDoc = parent.frames[theObj.substring(p+1)].document;    
		theObj = theObj.substring(0,p); 
	} 
	if(!(foundObj = theDoc[theObj]) && theDoc.all) 
	foundObj = theDoc.all[theObj]; 
	
	for (i=0; !foundObj && i < theDoc.forms.length; i++)     
	foundObj = theDoc.forms[i][theObj]; 
	
	for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)     
	foundObj = findObj(theObj,theDoc.layers[i].document); 
	
	if(!foundObj && document.getElementById) 
	foundObj = document.getElementById(theObj);    
	
	return foundObj;
}
	
//添加一个药品填写行
function AddSignRow(){ //读取最后一行的行号，存放在txtTRLastIndex文本框中 
	var txtTRLastIndex = findObj("txtTRLastIndex",document);
	alert("1");
	var rowID = parseInt(txtTRLastIndex.value);
	alert("2");
	var signFrame = findObj("SignFrame",document);alert("3");
	//添加行
	var newTR = signFrame.insertRow(signFrame.rows.length);alert("4");
	newTR.id = "SignItem" + rowID;alert("5");
	
	//添加列:序号
	var newNameTD=newTR.insertCell(0);
	//添加列内容
	newNameTD.innerHTML = newTR.rowIndex.toString();
	
	//添加列:药名
	var newNameTD=newTR.insertCell(1);
	//添加列内容
	newNameTD.innerHTML = "<span>aaa</span><input type='hidden' id='mid' value=''>";
	
	//添加列:用药说明
	var newEmailTD=newTR.insertCell(2);
	//添加列内容
	newEmailTD.innerHTML = "<input name='" + 1 + "' id='" + 1 + "' type='text' size='100' />";
	
	//添加列:删除按钮
	var newDeleteTD=newTR.insertCell(3);
	//添加列内容
	newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' onclick=\"DeleteSignRow('SignItem" + rowID + "')\">删除</a></div>";
	
	//将行号推进下一行
	txtTRLastIndex.value = (rowID + 1).toString() ;
}

//删除指定行
function DeleteSignRow(rowid){
	var signFrame = findObj("SignFrame",document);
	var signItem = findObj(rowid,document);
	
	//获取将要删除的行的Index
	var rowIndex = signItem.rowIndex;
	
	//删除指定Index的行
	signFrame.deleteRow(rowIndex);
	
	//重新排列序号，如果没有序号，这一步省略
	for(i=rowIndex;i<signFrame.rows.length;i++){
		signFrame.rows[i].cells[0].innerHTML = i.toString();
	}
}

//清空列表
function ClearAllSign(){
	if(confirm('确定要清空所有参与人吗？')){
		var signFrame = findObj("SignFrame",document);
		var rowscount = signFrame.rows.length;
		
		//循环删除行,从最后一行往前删除
		for(i=rowscount - 1;i > 0; i--){
		   signFrame.deleteRow(i);
		}
		
		//重置最后行号为1
		var txtTRLastIndex = findObj("txtTRLastIndex",document);
		txtTRLastIndex.value = "1";
		
		//预添加一行
		AddSignRow();
	}
}	

function addNewRow(){
	var $table= $("#SignFrame"); 
	var vTr= '<tr target="sid_user" rel="1"><td>1</td><td>茶籽洗发水</td>	<td><input type="text" size="100"/></td><td><a title="删除" target="ajaxTodo" href="demo/common/ajaxDone.html?id=xxx" class="btnDel">删除</a></td></tr>';
	$table.append(vTr); 
}


function   AddRow(){
              var vTb=$("#TbData");//得到表格ID=TbData的jquery对象    
              //所有的数据行有一个.CaseRow的Class,得到数据行的大小
              var vNum=$("#TbData tr").filter(".CaseRow").size()+1;//表格有多少个数据行 
              var vTr=$("#TbData #trDataRow1"); //得到表格中的第一行数据   
              var vTrClone=vTr.clone(true);//创建第一行的副本对象vTrClone
              vTrClone[0].id="trDataRow"+vNum;//設置 第一個Id為當前獲取索引；防止重複添加多個ID為trDataRow1的數據行；一次添加一個；
              vTrClone.appendTo(vTb);//把副本单元格对象添加到表格下方         
       } 
</script>

</head>
<body>

	<form method="post" action="<%=basePath %>demo/common/ajaxDone.html" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
		<div class="pageContent" style="padding:5px">
				<div class="panel" defH="100">
					<h1>接诊信息</h1>
							<div class="pageFormContent" defH="56">
				<!-- 检测信息区begin -->
			<p>
				<label>是否检测：</label>
				<select name="capital" class="combox">
					<option value="">请选择</option>
					<option value="10">是</option>
					<option value="50">否</option>
					
				</select>
				<span class="unit"></span>
			</p>
			<p>
				<label>头发检测（脱发区）：</label>
				<select name="capital" class="combox">
					<option value="">请选择</option>
					<option value="10">细小</option>
					<option value="50">萎缩</option>
					<option value="10">受损</option>
					<option value="10">坏死</option>
				</select>
				<span class="unit"></span>
			</p>
			<p>
				<label>头皮油脂：</label>
				<select name="capital"  class="combox">
					<option value="">请选择</option>
					<option value="10">偏油</option>
					<option value="50">油性</option>
					<option value="10">中性</option>
					<option value="10">干性</option>
					<option value="10">偏干</option>
				</select>
				<span class="unit"></span>
			</p>
			<p>
				<label>头发密度（供体区）：</label>
				<select name="capital" class="combox">
					<option value="">请选择</option>
					<option value="10">A</option>
					<option value="50">B</option>
				</select>
				<span class="unit"></span>
			</p>
			<p>
				<label>头皮弹性：</label>
				<select name="capital" class="combox">
					<option value="">请选择</option>
					<option value="10">较好</option>
					<option value="50">一般</option>
					<option value="10">偏差</option>
				</select>
				<span class="unit"></span>
			</p>
			
			<!-- 检测信息区end -->
			<div class="divider"></div>
			<p>
				<label>治疗方案：</label>
				<select id="schema" name="schema" class="combox" onchange="displayData()">
					<option value="">请选择</option>
					<option value="10">手术治疗</option>
					<option value="50">药物治疗</option>
				</select>
				<span class="unit"></span>
			</p>
			<p>
				<label>是否建立病例：</label>
				<select name="capital" class="combox">
					<option value="">请选择</option>
					<option value="10">是</option>
					<option value="50">否</option>
				</select>
				<span class="unit"></span>
			</p>
			
			<!-- 预约就诊begin -->
			<div class="divider"></div>
			<p>
					<label>是否预约就诊：</label>
					<select id="isCallBack" name="isCallBack" class="combox"
						onchange="">
						<option value="">请选择</option>
						<option value="0">是</option>
						<option value="1">否</option>
					</select>
				</p>
				<p><label>日期：</label><input type="text" id="appointDate" name="appointDate" class="date" size="30" />
					<a class="inputDateButton" href="javascript:;">选择</a>
				</p>
			<!-- 预约就诊end -->
			
			<!-- 药物治疗层begin -->
			<div id="medicineDiv" style="display:none;"> 
				
				<p>
					<label>用药史：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>
						<option value="10">术前</option>
						<option value="50">术后</option>
						<option value="50">二次加密后</option>
						<option value="50">无</option>
					</select>
					<span class="unit"></span>
				</p>
				<p>
					<label>首次用药时间：</label>
					<input type="text" id="appointDate" name="appointDate"  class="date" size="30" /><a class="inputDateButton" href="javascript:;">选择</a>
				</p>
				<p>
					<label>首次用药数量：</label>
					<label><input type="text" id="" name=""  class="" size="30" /></label>
				</p>
				<p>
					<label>药物选择：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>
						<option value="medicinal0001">国产启悦</option>
						<option value="medicinal0002">进口保法止</option>
						<option value="medicinal0003">2%米诺地尔</option>
						<option value="medicinal0004">5%米诺地尔</option>
						<option value="medicinal0005">PA洗发水</option>
						<option value="medicinal0006">生姜洗发水</option>
						<option value="medicinal0007">茶籽洗发水</option>
					</select>
					<!--<button class="" href="javascript:AddSignRow();">ADD</button>
					--><input type="button" name="Submit" value="Add" onclick="AddRow()" /> 
					<span class="unit"></span>
				</p>
				
				<!--<dl class="nowrap">
					<dt>备注：</dt>
					<dd><textarea id="appointmemo" name="appointmemo" cols="80" rows="2"></textarea></dd>
				</dl>
				-->
				<br/>
				
				<table class="table" id="TbData" name="TbData" width="800" layoutH="">
					<thead>
						<tr>
							<th width="5%">序号</th> 
							<th width="30%">药名</th>
							<th width="70%">用药说明</th>
							<th width="70%">是否免费赠送</th>
							<th width="20%">操作</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>1</th> 
							<td>茶籽洗发水</th>
							<td><input id="" name="" size="100" value="一日一次，外用，持续使用三个月" /></th>
							<td>
								<a title="删除" href="" class="delete">【 删除 】</a>
							</th>
						</tr>
					</tbody>
				</table>
				<input name='txtTRLastIndex' type='hidden' id='txtTRLastIndex' value="1" />
		
				
			</div>
			<!-- 药物治疗层end -->
			
			<!-- 手术治疗层begin -->
			<div id="operationDiv" style="display:none;"> 
				
				<p>
					<label>手术技术：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>
						<option value="10">FUT</option>
						<option value="50">FUE </option>
						<option value="10">PDT</option>
						<option value="10">PDE</option>
					</select>
					<span class="unit"></span>
				</p>
				<p>
					<label>合同种植数量：</label>
					<input name="name" type="text" size="30" value="" alt=""/>
					<span class="unit"></span>
				</p>
				<p>
					<label>合同单价：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>
						<option value="10">6元</option>
						<option value="50">9元 </option>
						<option value="10">10元</option>
						<option value="10">12元</option>
					</select>
					<span class="unit"></span>
				</p>
				<p>
					<label>合同金额：</label>
					<input name="name" type="text" size="30" value="" alt=""/>
				</p>
				<p>
					<label>是否化验：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>
						<option value="10">是</option>
						<option value="50">否 </option>
					</select>
					<span class="unit"></span>
				</p>
				<p>
					<label>化验是否正常：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>
						<option value="10">是</option>
						<option value="50">否 </option>
					</select>
					<span class="unit"></span>
				</p>
				<p>
					<label>乙肝两对半：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>
						<option value="10">阴性</option>
						<option value="50">阳性</option>
					</select>
					<span class="unit"></span>
				</p>
				<p>
				<label>是否预约手术：</label>
				<select name="capital" class="combox">
					<option value="">请选择</option>
					<option value="10">是</option>
					<option value="50">否 </option>
				</select>
				<span class="unit"></span>
				</p>
				<p>
					<label>预约手术医生：</label>
					<select name="capital" class="combox">
						<option value="">请选择</option>  
						<option value="10">术中医生1</option>
						<option value="50">术中医生2 </option>
					</select>
				</p>	
				<p>
					<label>预约手术日期：</label>
					<input type="text" id="appointDate" name="appointDate"  class="date" size="30" /><a class="inputDateButton" href="javascript:;">选择</a>
					<dl class="nowrap">
						<dt>备注：</dt>
						<dd><textarea id="appointmemo" name="appointmemo" cols="80" rows="2"></textarea></dd>
					</dl>
				</p>
			</div>
			<!-- 手术治疗层end -->
			
			<!-- 治疗方案区end -->
			<div class="divider"></div>
		</div>
		
	</div>
	<div class="divider"></div>
	<div class="tabs">
			<jsp:include flush="true" page="/mcms/custom/qddepart/detailCustom_qd.jsp" />
	</div>
	
</div>

	</form>


</body>
</html>